In [10]:
import addcoord
import pygslib

test with arbitrary gslib files


In [11]:
parameters = {
            'datafl': 'true.dat',      # path to the input grid file or data
            'outfl' : None,      # path to the output grid file
            'ireal' : 1,          # realization number
            'nx'    : 50,      # number of rows, cols and levels
            'ny'    : 50,
            'nz'    : 1,
            'xmn'   : 0.5,    # coordinates of the centroid of first/corner block
            'ymn'   : 0.5,
            'zmn'   : 0,
            'xsiz'  : 1,    # grid node separation
            'ysiz'  : 1,
            'zsiz'  : 1}

In [12]:
result =addcoord.addcoord(parameters)


                  Parameters for ADDCOORD
                  ***********************

START OF PARAMETERS:
true.dat                          -file with data
_xxx_.out                           -file for output
1                           -realization number
50  0.5  1               -nx,xmn,xsiz
50  0.5  1               -ny,ymn,ysiz
1  0  1               -nz,zmn,zsiz

c:\gslib\addcoord.exe

ADDCOORD Version: 2.907

Data File = true.dat                                
Output File = _xxx_.out                               
Realization number =            1
X grid size =           50    5.000000E-01        1.000000
Y grid size =           50    5.000000E-01        1.000000
Z grid size =            1    0.000000E+00        1.000000

Format: (f10.5,1x,f10.5,1x,f10.7,1x,a)      

ADDCOORD Version: 2.907 Finished

Stop - Program terminated.


In [13]:
result.head()


Out[13]:
X Y Z Primary Secondary
0 0.5 0.5 0.0 2.26 3.26
1 1.5 0.5 0.0 3.28 2.64
2 2.5 0.5 0.0 2.80 2.15
3 3.5 0.5 0.0 0.95 1.69
4 4.5 0.5 0.0 0.12 0.51

test with block model


In [14]:
# genarate a block model
nx = 50
ny = 70
nz = 10
dx = 20
dy = 20
dz = 10
xorg = 0
yorg = 0
zorg = 0

# create a block model object
bmod = pygslib.blockmodel.Blockmodel(nx=nx,ny=ny,nz=nz,
                               dx=dx,dy=dy,dz=dz,
                               xorg=xorg,yorg=yorg,zorg=zorg)
# create a full model 
bmod.create_IJK()

In [15]:
result =addcoord.addcoord(bmod)


                  Parameters for ADDCOORD
                  ***********************

START OF PARAMETERS:
_xxx_.in                          -file with data
_xxx_.out                           -file for output
1                           -realization number
50  10.0  20.0               -nx,xmn,xsiz
70  10.0  20.0               -ny,ymn,ysiz
10  5.0  10.0               -nz,zmn,zsiz

c:\gslib\addcoord.exe

ADDCOORD Version: 2.907

Data File = _xxx_.in                                
Output File = _xxx_.out                               
Realization number =            1
X grid size =           50       10.000000       20.000000
Y grid size =           70       10.000000       20.000000
Z grid size =           10        5.000000       10.000000

Format: (f10.4,1x,f10.3,1x,f10.5,1x,a)      

ADDCOORD Version: 2.907 Finished

Stop - Program terminated.


In [16]:
result.head()


Out[16]:
X Y Z IJK
0 10.0 10.0 5.0 0.0
1 30.0 10.0 5.0 1.0
2 50.0 10.0 5.0 2.0
3 70.0 10.0 5.0 3.0
4 90.0 10.0 5.0 4.0

In [17]:
bmod.set_blocks(bmod.bmtable.merge(result, on='IJK' ))
bmod.bmtable.head()


Out[17]:
IJK X Y Z
0 0 10.0 10.0 5.0
1 1 30.0 10.0 5.0
2 2 50.0 10.0 5.0
3 3 70.0 10.0 5.0
4 4 90.0 10.0 5.0

In [18]:
bmod.calc_ixyz_fromijk()
bmod.calc_xyz_fromixyz()
bmod.bmtable.head()


Out[18]:
IJK X Y Z IX IY IZ XC YC ZC
0 0 10.0 10.0 5.0 0 0 0 10.0 10.0 5.0
1 1 30.0 10.0 5.0 1 0 0 30.0 10.0 5.0
2 2 50.0 10.0 5.0 2 0 0 50.0 10.0 5.0
3 3 70.0 10.0 5.0 3 0 0 70.0 10.0 5.0
4 4 90.0 10.0 5.0 4 0 0 90.0 10.0 5.0

In [ ]: